package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.EquitySharePool;
import com.sc.nft.mapper.EquitySharePoolMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;

/**
 * (sc_equity_share_pool)数据DAO
 *
 * @author zxy
 * @since 2024-08-31 18:09:02
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class EquitySharePoolDao extends ServiceImpl<EquitySharePoolMapper, EquitySharePool> {

    public void addAmount(Long id, BigDecimal amount){
        UpdateWrapper<EquitySharePool> updateWrapper = new UpdateWrapper<EquitySharePool>();
        updateWrapper.eq("id", id);
        updateWrapper.setSql(" sum_amount=sum_amount+"+amount);
        update(updateWrapper);
    }

    public void subAmount(Long id, BigDecimal amount){
        UpdateWrapper<EquitySharePool> updateWrapper = new UpdateWrapper<EquitySharePool>();
        updateWrapper.eq("id", id);
        updateWrapper.setSql(" sum_amount=sum_amount-"+amount);
        update(updateWrapper);
    }
}